home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93c.txt / 000043_icon-group-sender _Tue Sep 7 09:30:57 1993.msg < prev    next >
Internet Message Format  |  1994-02-02  |  1KB

  1. Received: from owl.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Tue, 7 Sep 1993 08:23:43 MST
  2. Received: by owl.cs.arizona.edu; Tue, 7 Sep 1993 08:23:42 MST
  3. Message-Id: <9309071457.AA15180@relay2.UU.NET>
  4. Subject: Re: return results
  5. To: uunet!cs.arizona.edu!icon-group@uunet.uu.net (Icon News Group)
  6. Date: Tue, 7 Sep 93 9:30:57 CDT
  7. From: Jerry Nowlin <nowlin%isidev@uunet.uu.net>
  8. X-Mailer: ELM [version 2.3 PL11]
  9. Status: R
  10. Errors-To: icon-group-errors@cs.arizona.edu
  11.  
  12. > I've been using Icon for seberal years now, but recently I stumbled across a
  13. > 'problem' for the fist time - I wanted to return more than one result from a
  14. > procedure (yup - strange to relate, after several years I had never needed to
  15. > do this before).
  16. > What I want to know is "what is the 'best' way to return several results from
  17. > a procedure?'. One obvious way to do it is to use a list:
  18. > procedure myproc
  19. >   .
  20. > list_of_results:=[]
  21. >   .
  22. >   .
  23. > list_of_results[1]:=...
  24. > list_of_results[2]:=...
  25. >   .
  26. >   .
  27. > return list_of_results
  28. > end
  29. > but I guess that one could use a record.
  30. > Any thoughts on which is best?
  31. > Thanks.
  32. > Roger Hare
  33.  
  34. It sounds like you should turn your procedure into a generator.  That's
  35. the iconish (sic) way to return more than one result from a procedure. 
  36. When the list of results is exhausted the procedure fails.
  37.  
  38. Jerry Nowlin
  39. uunet!isidev!nowlin (uucp)
  40. isidev!nowlin@uunet.uu.net (internet)
  41.  
  42.